<template>
	<view class="">
		<view class="he1 w100pc"></view>
		<!-- 头部 -->
		<view class="fsb lrmg-30" style="height: 100rpx;">
			<image src="/static/image/9.png" style="width:86rpx;height:50rpx" class="" @click="pageback()"></image>
			<view class="flex aic">
			</view>
		</view>
		<view class="he3 w100pc"></view>
		<!-- 轮播 -->
		<u-swiper :list="lists" height="400" :effect3d="true" border-radius="20"></u-swiper>
		<view class="he4 w100pc"></view>
		<view class="fsb" style="margin: 0 40rpx 30rpx;" v-for="(it,i) in list" :key="i" @tap="tiaozhuan(it)">
			<view class="fdc jsb" style="width: calc(100% - 220rpx);height: 170rpx;">
				<view class="gray272 f26 over3x lne35" style="">
					{{it.title}}
				</view>
				<view class="fsb">
					<view class="flex aic">
						<image :src="getRequestUrl + it.author_logo" style="width:60rpx;height:60rpx" class="bra50"></image>
						<view class="gray666 f22 mg-l-10">{{it.author}}</view>
					</view>
					<view class="gray999 f22">浏覽{{it.browse}}</view>
				</view>
			</view>
			<image :src="getRequestUrl + it.pic" style="width:200rpx;height:170rpx" mode="aspectFill" class="bra20"></image>
		</view>
		<u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" />
		<view class="w100pc" style="height: 160rpx;"></view>
		<view class="" style="position: fixed;bottom: 40rpx;left: 0;width: 100%;z-index: 999;">
			<view class="lrmg-40 bg-orange fsb lrpadd-20 bra60" style="height: 100rpx;" @click="types == 1 ? pageto('/pages/home/cs_tijiao?id=' + ids) : pageto('/pages/home/dz_tijiao?id=' + ids)">
				<view class="flex aic">
					<image src="/static/image/10.png" mode="" style="width: 80rpx;height: 80rpx;"></image>
					<view class="f30 gray272 mg-l-20">{{title}}</view>
				</view>
				<image src="/static/image/11.png" style="width:83rpx;height:48rpx" class=""></image>
			</view>
		</view>
	</view>
</template>

<script>
	var	that
	import {
		_updataTabBar,
		pageto,
		pageback
	} from "../../common/js/sysfun.js"
	import {
		mapGetters,
		mapMutations
	} from 'vuex'
	export default{
		data(){
			return{
				lists: [],
				status: 'loadmore',
				iconType: 'flower',
				loadText: {
					loadmore: '輕輕上拉',
					loading: '努力加載中',
					nomore: '實在沒有了'
				},
				list: [],
				page: 1,
				pageSize:10,
				ids:'',
				title:'',
				types:''
			}
		},
		computed: {
			i18n() {
				return this.$t('message');
			},
			...mapGetters([
				'getRequestUrl',
				'getLangType',
				'getTextArr',
				'getLoginInfo'
			])
		},
		onLoad(e) {
			that = this
			that.ids = e.id
			that.types = e.types
			that.gets()
		},
		onReachBottom() {
			if (that.total <= that.page * that.pageSize){
				this.status = 'nomore';
				return
			} 
			this.status = 'loading';
			let postData
			postData = {
				id:that.ids,
				page:that.page + 1,//第几页（默认第一页）
				limit:that.pageSize,//显示条数（默认10条）
			}
			that.$postAjax('api/index/charitable',postData,function(res){
				console.log(res,2222)
				uni.hideLoading()
				that.list = that.list.concat(res.data.data)
				that.page = that.page + 1
				that.status = 'loadmore';
			})
		},
		methods:{
			tiaozhuan(it){
				uni.navigateTo({
					url:'/pages/home/zx_detail?obj_item=' + JSON.stringify(it)
				})
			},
			gets(){
				that.status = 'loadmore';
				that.page = 1
				let temp = {
					id:that.ids,
					page:that.page,//第几页（默认第一页）
					limit:that.pageSize,//显示条数（默认10条）
				}
				that.$postAjax('api/index/charitable',temp,function(res){
					console.log(res);
					// console.log(that.getRequestUrl + res.data.class.pic);
					that.lists.push({image:that.getRequestUrl + res.data.class.pic})
					that.title = res.data.class.title
					that.list = res.data.data
					that.total = res.data.total
					if (that.total <= that.page * that.pageSize){
						that.status = 'nomore';
					}
				})
			},
			pageto(url, pp) {
				pageto(url, pp);
			},
			pageback(){
				pageback()
			}
		}
	}
</script>

<style lang="scss">
	
</style>